package me.shiqiang.im.msg;

import com.fasterxml.jackson.annotation.JsonSubTypes;
import com.fasterxml.jackson.annotation.JsonTypeInfo;
import me.shiqiang.im.enums.MessageCmd;

/**
 * @author cuishiqiang
 * @date 2017/12/5 下午5:40
 */
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME,include = JsonTypeInfo.As.EXISTING_PROPERTY,property = "cmd")
@JsonSubTypes({
        @JsonSubTypes.Type(value = Login.class,name = MessageCmd.LOGIN),
        @JsonSubTypes.Type(value = SndMsg.class,name = MessageCmd.SND_MSG),
        @JsonSubTypes.Type(value = NewMsg.class,name = MessageCmd.NEW_MSG),
        @JsonSubTypes.Type(value = SyncReq.class,name = MessageCmd.SYNC_MSG_REQ),
        @JsonSubTypes.Type(value = SyncMsg.class,name = MessageCmd.SYNC_MSG_RES),
        @JsonSubTypes.Type(value = SyncFriendReq.class,name = MessageCmd.SYNC_FRIEND_REQ),
        @JsonSubTypes.Type(value = SyncFriendResp.class,name = MessageCmd.SYNC_FRIEND_RESP),
        @JsonSubTypes.Type(value = SyncGroupResp.class,name = MessageCmd.SYNC_GROUP_RESP)
})
public class Resp {

    private String cmd;

    public String getCmd() {
        return cmd;
    }

    public void setCmd(String cmd) {
        this.cmd = cmd;
    }

    private Integer version = 1;

    public Integer getVersion() {
        return version;
    }

    public void setVersion(Integer version) {
        this.version = version;
    }

    @Override
    public String toString() {
        return "Resp{" +
                "version=" + version +
                '}';
    }
}
